var util = require('../../../utils/util.js');
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
      ishidden:false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    wx.getStorage({
      key: 'userInfo',
      success: function (res) {
        that.setData({
          userInfo: res.data
        })
        util.getReq("/app/sdm/findApartmentDaiFu", {
          source: res.data.source,
          uid: res.data.user_id,
          user_type_id: res.data.user_type_id,
          phone_num: res.data.phone_num,
          user_name: res.data.user_name
        }, function (datas) {
          if (datas.code == 0) {
            var dats = datas.data;
            if(dats.length>0){
              that.setData({
                ishidden: true
              })
            }
            that.setData({
              dataList: dats
            })

          } else {
            var errMsg = '服务器异常';
            if (datas.desc) {
              errMsg = datas.desc;
            }
            wx.showToast({
              title: errMsg,
            })
          }

        })
      }, fail: function () {
        wx.redirectTo({
          url: '/pages/index/index',
        })
      }
    });
  },
  /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh(true);
  },

  
  /**
   * 页面点击跳转
   */
  negativeTOroom:function(e){
    var url = "/pages/home/roomNoPay/roomNoPay?apartment_id=" + e.currentTarget.dataset.value + "&&apartment_name=" + e.currentTarget.dataset.name;
    wx.navigateTo({
      url: url,
    })
  }
})